package com.whfc.fmam.dao;

import com.whfc.fmam.entity.bo.FmamWeighNoteMat;
import com.whfc.fmam.entity.dto.FmamNoteMatDTO;
import com.whfc.fmam.entity.dto.FmamSupplierAnaMatDTO;
import com.whfc.fmam.entity.dto.FmamWeighNoteDailyDTO;
import com.whfc.fmam.entity.dto.FmamWeightNoteExportDTO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.Collection;
import java.util.Date;
import java.util.List;

@Repository
public interface FmamWeighNoteMatMapper {
    int deleteByPrimaryKey(Long id);

    int insert(FmamWeighNoteMat record);

    int insertSelective(FmamWeighNoteMat record);

    FmamWeighNoteMat selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(FmamWeighNoteMat record);

    int updateByPrimaryKey(FmamWeighNoteMat record);

    /**
     * 批量逻辑删除磅单材料
     *
     * @param weighNoteGuidList
     * @return
     */
    int batchDeleteByWeighNoteGuid(@Param("weighNoteGuidList") Collection<String> weighNoteGuidList);

    /**
     * 批量插入磅单材料
     *
     * @param weightNoteMatList
     * @return
     */
    int batchInsert(@Param("weightNoteMatList") Collection<FmamWeighNoteMat> weightNoteMatList);

    /**
     * 查询磅单材料列表
     *
     * @param weighNoteGuid
     * @return
     */
    List<FmamWeighNoteMat> selectWeighNoteMatList(@Param("weighNoteGuid") String weighNoteGuid);

    /**
     * 根据磅单guid查找
     *
     * @param weighNoteGuid
     * @return
     */
    List<FmamNoteMatDTO> selectByWeighNoteGuid(@Param("weighNoteGuid") String weighNoteGuid);

    /**
     * 查询榜单中的材料数据
     *
     * @param
     * @return
     */
    List<FmamSupplierAnaMatDTO> selectFmamNoteMatDTO(@Param("deptId") Integer deptId,
                                                     @Param("startTime") Date startTime,
                                                     @Param("endTime") Date endTime,
                                                     @Param("sendSupplierId") Integer sendSupplierId,
                                                     @Param("matId") Long matId,
                                                     @Param("matTypeIdList") List<Long> matTypeIdList,
                                                     @Param("sourceList") List<Integer> sourceList);


    /**
     * 获取磅单下的材料列表
     *
     * @param weighNoteGuid
     * @param matId
     * @param matTypeIdList
     * @return
     */
    List<FmamNoteMatDTO> selectNoteMatList(@Param("guid") String weighNoteGuid,
                                           @Param("matId") Long matId,
                                           @Param("matTypeIdList") List<Long> matTypeIdList);

    /**
     * 查询磅单导出数据
     *
     * @param deptId
     * @param startTime
     * @param endTime
     * @param code
     * @param diffResultList
     * @param licensePlate
     * @param matId
     * @param matTypeIdList
     * @param receiveSupplierId
     * @param recvSendTypeList
     * @param sendSupplierId
     * @param sourceList
     * @param weightNoteType
     * @param warehouseId
     * @return
     */
    List<FmamWeightNoteExportDTO> selectMatListDTO(@Param("deptId") Integer deptId,
                                                   @Param("startTime") Date startTime,
                                                   @Param("endTime") Date endTime,
                                                   @Param("code") String code,
                                                   @Param("diffResultList") List<Integer> diffResultList,
                                                   @Param("licensePlate") String licensePlate,
                                                   @Param("matId") Long matId,
                                                   @Param("matTypeIdList") List<Long> matTypeIdList,
                                                   @Param("receiveSupplierId") Integer receiveSupplierId,
                                                   @Param("recvSendTypeList") List<Integer> recvSendTypeList,
                                                   @Param("sendSupplierId") Integer sendSupplierId,
                                                   @Param("sourceList") List<Integer> sourceList,
                                                   @Param("weightNoteType") Integer weightNoteType,
                                                   @Param("warehouseId") Integer warehouseId);

    /**
     * 材料进出场日报
     *
     * @param deptId
     * @param weightNoteType
     * @param startTime
     * @param endTime
     * @return
     */
    List<FmamWeighNoteDailyDTO> selectDailyByDeptId(@Param("deptId") Integer deptId, @Param("weightNoteType") Integer weightNoteType,
                                                    @Param("startTime") Date startTime, @Param("endTime") Date endTime);
}
